package main

import (
	"fmt"
	"log"
	"net"
	"time"
)

func main() {
	//dial：拨号
	dial, err := net.Dial("tcp", "127.0.0.1:8888")
	if err != nil {
		log.Println(err)
		return
	}
	time.Sleep(3 * time.Second)
	_, err = dial.Write([]byte("hello"))

	fmt.Println("发送消息成功")

	dial.Close()

	fmt.Println("客户端已关闭")

	time.Sleep(10 * time.Second)
}
